import Vue from 'vue'
import Vuex from "vuex"
Vue.use(Vuex)

if(!localStorage.getItem("cName")){
   localStorage.setItem("cName","北京")
}else{
    var cName=localStorage.getItem("cName")
}

const state={
    cityName:cName,
}
const mutations={
    changeName:(state,itemname)=>{
        state.cityName=itemname;
        localStorage.setItem("cName",itemname)
    }
}
export default new Vuex.Store({
    state,
    mutations
})